	<include file="Base:header" />
	<link rel="stylesheet" type="text/css" href="__CSS__/user.css"/>
		<div class="myfavorite min_height">
			<div class="user_head">
				<div class="user_head_nav">
					<a href="{:U('MyMessage/index')}"><p class="fl tab">消息</p></a>
					<a href="{:U('MyFavorite/index')}"><p class="fl tab show">收藏夹</p></a>
					<a href="{:U('MyHistory/index')}"><p class="fl tab">历史记录</p></a>
					<div class="search fr">
						<form action="{:U()}" method='post'>
							<input placeholder="请输入关键词" class="fl text" type="text" name="keyword" id="searchbar_value" value="{$_POST[keyword] ? $_POST[keyword] : ''}" />
							<div class="fl search_btn">
								<input class="" type="submit"  id="searchbar_submit" value="" />
							</div>
						</form>
						<div class="clear"></div>
					</div>
					<div class="clear"></div>
				</div>
			</div>
			<!-- 我的标签列表  -->
			<div class="favorite_content">
				<div class="favorite_content_top">
					<ul class="label">
					
					<li class="label_details fl">
						<span href="{:U('')}" class="label_name">全部标签</span><span>{$userlabel.label_total}</span>
					</li>
					<li class="label_details fl" style="color: #c30d23;">
						<span href="{:U('',['labelid'=>0])}" class="label_name">未加标签</span><span>{$userlabel.label_empty}</span>
					</li>
					<volist name='userlabel.label_list' id='vo'>
						<li class="label_details label_edit fl">
							<span href="{:U('index',['labelid'=>$vo[label_id]])}" label_id="{$vo.label_id}"  class="label_name" target="_blank">{$vo.label_name}</span><span>{$vo.total}</span>
							<a url="{:U('MyFavorite/labelDel',['labelid'=>$vo[label_id],'favnum'=>$vo[total]])}" class="remove ajax_confirm ajax_get reload" message='确定删除标签？'>x</a>
						</li>
					</volist>
					<div class="clear"></div>
				</ul>
				<a href="javascript:;" class="edit_btn fr" isclick="false">编辑</a>
				<div class="clear"></div>
				</div>
			</div>
			<!-- end 我的标签列表  -->
			<ul class="user_case">
				<volist name='list' id='vo'>
					<li class="fl hover">
						<a href="{:U('index/detail',['id'=>$vo[id]])}" target='_blank'>
							<img class="hotcase_img" src="{$vo.cover}" alt="" width='210' height='143' />
								<eq name='vo.t_lx' value='534'>
									<div class="index_mask"></div>
									<div class="index_maskimg"></div>
								</eq>
						</a>	
						<p class="hotcase_title fl">{$vo.summary}</p>
						<notempty name='vo.t_jx'>
							<img class="fr badge prize-icon" src="__IMG__/badge.png" prize-id='{$vo.t_jx}' alt="" />
						</notempty>
						<p class="hotcase_type fl">{$vo.title}</p>
						<p class="hotcase_label fl">
							<notempty name='vo.label_name'>
								<foreach name='vo.label_name' item='labelname'>
									<span>#{$labelname}</span>
								</foreach>
							</notempty> 
						</p>
						<a href="{:U('remove',['favid'=>$vo[fav_id]])}"  class="fr close_btn ajax_get ajax_confirm reload" message='确定取消收藏吗？'><img  src="__IMG__/close_btn.png"/></a>
					</li>
				</volist>
				<div class="clear"></div>

			</ul>
			<div class="pagebox">{$page}</div>
			
			
		</div>

		<include file="Base:footer" />

		<script type="text/javascript">
			var _url = "{$_SERVER['REQUEST_URI']}";

			
			$(".label_name").click(function(){
				var isclick = $(".edit_btn").attr("isclick");
				var href = $(this).attr("href");
				if(isclick == "false"){
					location.href = href;
				}
			})
			
			//标签的编辑
			$(".edit_btn").click(function(){
				var isnone = $(".label_edit .remove").css("display");
				if(isnone == "none"){
					$(".label_edit .remove").show();
					$(this).html("完成");
					$(this).attr("isclick","true");
					$(".favorite_content .label_details .label_name").css("cursor","text")
				}else{
					$(".favorite_content .label_details .label_name").css("cursor","pointer")
					$(this).attr("isclick","false");
					$(".label_edit .remove").hide();
					$(this).html("编辑");
				}
			})
				
			$("body").on("click","#layer_confirm",function(){
				var this_href = $(this).attr("href");
				$.ajax({
					type:"post",
					url:"",
					success:function(ret){
						location.href = this_href;	
						layer.closeAll();
					}
				});
			})	
				
				
			$(".label_name").click(function(){
				var isclick = $(".edit_btn").attr("isclick");
//				var _span_label_name = $(this).find(".label_name");
				var edit_text = $(this).html();
				var html = "";
				var __this = $(this);
				if(isclick !== "false"){
					html+="<input class='remove_input fl' type='' name='' id='' value='"+edit_text+"' />"
					__this.parent().after(html);
					__this.parent().hide();
					
					
					$(document).bind("click",function(evt){
						
						if($(evt.target).parents(".label").length==0){
							var remove_input = $(".remove_input").val();
							if(remove_input == ""){
								alert("标签目前仅支持中英文、数字或冒号哦，请按照要求来贴标签哦。")
								$('.remove_input').remove();
								__this.parent().show();
							}else{
								$(".remove_input").prev().find(".label_name").html(remove_input);
								$('.remove_input').remove();
								__this.parent().show();
								
								
								/* 单独发送请求，点击document进行发送 */
								var _label_id = __this.attr('label_id');
								var _new_label_name =__this.html();
								if (_new_label_name !== edit_text) {
									$.post("{:U('labelEdit')}",{'labelid':_label_id,'labelname':_new_label_name},function(){
										location.reload();
									})
								}
								
							}
						} 
					}); 
				}
				return false;
			})		
					

			
			$(".label .more_btn").click(function(){
				var isnone = $(".favorite_content .more_content").css("display");
				if(isnone == "none"){
					$(this).find("img").attr("src","__IMG__/details_bottomarrow.png");
					$(this).css("background-color","#efefef");
					$(".favorite_content .more_content").show();
					var labelwid = $(".label").width();
					$(".favorite_content_top .more_content").width(labelwid)	
				}else{
					$(this).css("background-color","none");
					$(this).find("img").attr("src","__IMG__/details_leftarrow.jpg");
					$(".favorite_content .more_content").hide();
				}
			})


			
			
			//取消收藏
			$("body").on("click","#layer_cancel",function(){
				layer.closeAll();
			})
			
			$(".user_case .hover").hover(function(){
				$(this).find(".close_btn").show();
			},function(){
				$(this).find(".close_btn").hide();
			})
		</script>

	</body>
</html>
